package com.example.hiandroid;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    public void ck_1(View view){
//        Intent intent = new Intent(MainActivity.this,MyActivity.class);
//        startActivity(intent);
        Intent intent = new Intent();
        intent.setClass(MainActivity.this,MyActivity.class);
        startActivity(intent);
    }

    public void ck_2(View view) {
        //准备Intent的data属性数据
        Uri uri = Uri.parse("https://www.baidu.com");
        //设置Intent的action属性和data属性
        Intent intent = new Intent(Intent.ACTION_VIEW,uri);
        //启动目标意图
        startActivity(intent);
    }
}
